﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Master/FrameMain.Master" AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="ECommerce.Web.ECAdmin.Product.Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 <style type="text/css">
        table
        {
            width: 100%;
        }
        .style1
        {
            width: 90px;
            text-align: right;
            padding-right: 5px;
            height: 30px;
             white-space:nowrap;
        }
        .style2
        {
        }
    </style>

    <script type="text/javascript" src="../../Common/Js/attach.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="toolbar">
        <ul>
            <li><a id="lnkSave" runat="server" href="javascript:;"><span><b style="background-image: url(../../common/images/common/save.gif);
                width: 35px;">&nbsp;</b><asp:Literal ID="Literal7" runat="server" Text="保存"></asp:Literal></span></a></li>
            <li><a id="lnkBack" runat="server" href="javascript:history.back();"><span><b style="background-image: url(../../common/images/common/back.gif);">
                &nbsp;</b><asp:Literal ID="Literal9" runat="server" Text="返回"></asp:Literal></span></a></li>
        </ul>
    </div>
    <asp:Panel ID="pnlMain" runat="server" Style="overflow-x: hidden; width: 100%;">
        <div style="padding: 0px 30px 0px 10px;">
            <table cellpadding="0" cellspacing="0">
                <tr class="dashed">
                    <td class="style1">
                        标题：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="Name" runat="server" CssClass="txt" Width="400px" 
                            MaxLength="100"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                            ControlToValidate="Name" ErrorMessage="请输入产品名称"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        状态：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="State" runat="server">
                        </asp:DropDownList>

                        <asp:CheckBox ID="Recommend" runat="server" Text="推荐" />
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        原价：</td>
                    <td class="style2">
                        &nbsp;<asp:TextBox ID="OldPrice" runat="server" CssClass="txt" Width="80px"></asp:TextBox>
                        &nbsp;现价： 
                        <asp:TextBox ID="CurrentPrice" runat="server" CssClass="txt" Width="80px"></asp:TextBox>
                        &nbsp;Vip价：<asp:TextBox ID="VipPrice" runat="server" CssClass="txt" Width="80px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="CurrentPrice" ErrorMessage="现价格式不对" 
                            ValidationExpression="\d*\.?\d+" Display="Dynamic"></asp:RegularExpressionValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="OldPrice" ErrorMessage="原价格式不对" 
                            ValidationExpression="\d*\.?\d+" Display="Dynamic"></asp:RegularExpressionValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                            ControlToValidate="VipPrice" Display="Dynamic" ErrorMessage="Vip价格式不对" 
                            ValidationExpression="\d*\.?\d+"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        尺寸：</td>
                    <td class="style2">
                        <asp:Repeater ID="rptSize" runat="server" 
                            onitemdatabound="rptSize_ItemDataBound">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkSize"  Text='<%#Eval("Name") %>' runat="server" /><asp:HiddenField ID="hidID" runat="server" Value='<%#Eval("ID") %>' />
                        </ItemTemplate>
                        </asp:Repeater>
                    </td>
                    </tr>

                <tr class="dashed">
                    <td class="style1">
                        标题图片：
                    </td>
                    <td class="style2">
                        <asp:FileUpload ID="fileSmallImage" runat="server" CssClass="txt" />
                        <a id="lnkSmallImage" runat="server" target="_blank"><asp:Image ID="imgSmallImage" runat="server" Visible= "false" Height="25px" ImageAlign="AbsMiddle" /></a>
                        <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/common/images/Common/delAttach.gif"
                                    ImageAlign="AbsMiddle"   Visible="false"
                            OnClientClick="return confirm('确认删除标题图片?')" onclick="btnDelete_Click" />
                         &nbsp;</td>
                </tr>

                <tr class="dashed">
                    <td class="style1">
                        广告图片：
                    </td>
                    <td class="style2">
                        <asp:FileUpload ID="fileAdImage" runat="server" CssClass="txt" />
                        <a id="lnkAdImage" runat="server" target="_blank"><asp:Image ID="imgAdImage" runat="server" Visible= "false" Height="25px" ImageAlign="AbsMiddle" /></a>
                        <asp:ImageButton ID="btnDelete2" runat="server" ImageUrl="~/common/images/Common/delAttach.gif"
                                    ImageAlign="AbsMiddle"   Visible="false"
                            OnClientClick="return confirm('确认删除标题图片?')" onclick="btnDelete2_Click" />
                         &nbsp;</td>
                </tr>                
                
                <tr class="dashed">
                    <td class="style1">
                        展示图片：
                    </td>
                    <td class="style2">
                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td style="width: 80px">
                                    <script type="text/javascript">                                       
                                        new ImageUpload("fileList", "pic");                                      
                                    </script>
                                </td>
                                <td id="fileList" style="word-break: break-all; padding-left: 5px;">
                                   
                                </td>
                            </tr>
                            
                        </table>
                    </td>
                </tr>
                <tr class="dashed" id="trImages" runat="server">
                    <td class="style1">
                    </td>
                    <td>
                        <asp:Repeater ID="rptPicture" runat="server" 
                            onitemcommand="rptPicture_ItemCommand">
                            <ItemTemplate>
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/common/images/Common/attach.gif" />&nbsp;<asp:HyperLink
                                    ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("BigImageAbsPath") %>' Text='<%# Eval("Name") %>'
                                    Target="_blank"></asp:HyperLink>
                                <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/common/images/Common/delAttach.gif"
                                    ImageAlign="AbsMiddle" CommandName="Delete" CommandArgument='<%#Eval("ID") %>' OnClientClick="return confirm('确认删除图片?')" />;&nbsp;
                            </ItemTemplate>
                        </asp:Repeater>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        品牌：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="Type1" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        用途：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="Type2" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>    
                <tr class="dashed">
                    <td class="style1">
                        材料：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="Type3" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>    
                <tr class="dashed">
                    <td class="style1">
                        对象：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="Type4" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>    
                <tr class="dashed">
                    <td class="style1">
                        造型：
                    </td>
                    <td class="style2">
                        <asp:DropDownList ID="Type5" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>               
                <tr class="dashed">
                    <td class="style1">
                        包装：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="Packag" CssClass="txt" runat="server" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        材料描述：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="Material" CssClass="txt" runat="server" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        花语：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="FlowerWord" CssClass="txt" runat="server" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        配送范围：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="SendRange" CssClass="txt" runat="server" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        备注说明：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="Remark" CssClass="txt" runat="server" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr class="dashed">
                    <td class="style1">
                        销量：
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="SalesVolume" CssClass="txt" runat="server" Width="98px"></asp:TextBox>
                        &nbsp;平均评分：
                        <asp:TextBox ID="AvgScore" CssClass="txt" runat="server" Width="94px"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                            ControlToValidate="SalesVolume" ErrorMessage="销量格式不对" Display="Dynamic" 
                            ValidationExpression="\d*\.?\d+"></asp:RegularExpressionValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                            ControlToValidate="AvgScore" ErrorMessage="评分格式不对" Display="Dynamic" 
                            ValidationExpression="\d*\.?\d+"></asp:RegularExpressionValidator>
                    </td>
                </tr>
               
            </table>
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td style="height: 2px;">
                        <img src="../../Common/Images/Common/keyline.gif" alt="" style="height: 2px; width: 100%" />
                    </td>
                </tr>
            </table>
        </div>
        <div style="text-align: left; padding-left: 100px; margin-top: 5px;" id="buttons">
            <asp:Button ID="btnSave" runat="server" Text="保存" Width="60px" OnClick="btnSave_Click" />&nbsp;&nbsp;
            <input id="Button1" type="button" value="返回" style="width: 60px;" onclick="history.back()" />
        </div>
        <div>
            &nbsp;</div>
    </asp:Panel>
    <script type="text/javascript">

        var form = document.forms[0];

        function form_submit()
        {

            if (Page_IsValid)//判断验证控件是否全部通过验证
            {
                window.setTimeout(function ()
                {

                    var btnSave = document.getElementById("<%=btnSave.ClientID %>");
                    btnSave.value = "正在提交数据...";
                    btnSave.style.width = "200px";
                    //btnSave.disabled = "disabled";
                    btnSave.onclick = function ()
                    {
                        alert("正在提交数据，请勿重复提交！");
                        return false;
                    };
                }, 1);
            }
        }

        if (form.attachEvent)
        {
            form.attachEvent("onsubmit", form_submit);
        }
        else if (form.addEventListener)
        {
            form.addEventListener("submit", form_submit, false);
        }
        
</script>
</asp:Content>
